package com.yunche.yunchebusiness.ui.activity.system

import com.yunche.yunchebusiness.R
import com.yunche.yunchebusiness.base.BaseActivity
import com.yunche.yunchebusiness.common.Constant
import com.yunche.yunchebusiness.ui.view.ChaosGestureView
import com.yunche.yunchebusiness.utils.SpHelper
import com.yunche.yunchebusiness.utils.ToastyUtils
import kotlinx.android.synthetic.main.activity_gesture.*


class GestureActivity : BaseActivity(), ChaosGestureView.GestureCallBack {

    override fun gestureVerifySuccessListener(
        stateFlag: Int, data: MutableList<ChaosGestureView.GestureBean>?, success: Boolean
    ) {
        if (success) {
            ToastyUtils.showSuccess("设置完成")
            SpHelper.putValue(Constant.SP_KEY.IS_SET_GESTURE, success)
            finish()
        } else {
            ToastyUtils.showSuccess("设置失败")
        }
    }

    override fun setLayout(): Int = R.layout.activity_gesture


    override fun initView() {
        gesture.clearCache()
        ToastyUtils.showInfo("手势密码已清除")
        SpHelper.putValue(Constant.SP_KEY.IS_SET_GESTURE, false)
        gesture.setGestureCallBack(this)
    }

    override fun initData() {

    }

    override fun initEvent() {
        tv_reset.setOnClickListener {
            gesture.clearCacheLogin()

        }

    }
}
